<include file="__PUBLIC__/_header" />
<div class="main-container" id="main-container">
    <div class="page-content">
        <!-- /.page-header -->
        <div class="row">
            <div class="col-xs-12">
                <div class="row">
                    <div class="col-xs-12">
                            <table id="data-table" class="table table-bordered table-hover definewidth m10" >
                                <tbody>
                                <tr>
                                    <th width="10%">登录帐号</th>
                                    <td>
                                       <input type="text" name="mobile" value="{$user.mobile}">
                                    </td>
                                </tr>
                                <tr>
                                    <th width="10%">登录密码</th>
                                    <td>
                                        <input type="password" name="pwd" value="">
                                    </td>
                                </tr>
                                <tr>
                                    <td id="result" colspan="2">

                                    </td>
                                </tr>
                                <tr>
                                    <th width="10%">用户状态</th>
                                    <td>
                                       <select name="state">
                                           <option value="0" <if condition="$user.state eq 0">selected</if>>未激活</option>
                                           <option value="1" <if condition="$user.state eq 1">selected</if>>已激活</option>
                                           <option value="2" <if condition="$user.state eq 2">selected</if>>已冻结</option>
                                       </select>
                                    </td>
                                </tr>
                                </tbody>
                                <tfoot>
                                <tr>
                                    <td colspan="13">
                                        <button class="btn btn-info" type="button" id="base_submit"> <i class="icon-ok bigger-110"></i> 确定 </button>
                                    </td>
                                </tr>
                                </tfoot>
                            </table>
                    </div>
                    <!-- /span -->
                </div>
                <!-- /row -->
            </div>
            <!-- PAGE CONTENT ENDS -->
        </div>
        <!-- /.row -->
    </div>
</div>
<script src="__APP_SKIN__js/jquery-2.0.3.min.js"></script>
<script src="__APP_SKIN__js/bootstrap.min.js"></script>
<script>
$(function(){
    $("#base_submit").click(function(){
        var user_id = {$user.user_id};
		if($("input[name=pwd]").val()==''){
				alert("密码不能为空!");
				return false;
		}
        $.ajax({
            type:"POST",
            async:false,
            dataType:"json",
            url:"{:Controller::_createUrl('user/passwordSet',$_GET)}",
            data:{user_id:user_id,mobile:$("input[name=mobile]").val(),password:$("input[name=pwd]").val(),state:$("select[name=state]").val()},
            success:function(data,textStatus){
                window.parent.$.fn.colorbox.close();
                window.parent.bootbox.dialog({
                    message: "<span class='btn-sm btn-success'>更新成功</span>"
                });
            },
            error:function(XMLHttpRequest,textStatus,errorThrown){
                window.parent.$.fn.colorbox.close();
                window.parent.bootbox.dialog({
                    message: "<span class='btn-sm btn-success'>网络错误，请稍后再试</span>"
                });
            }
        });
    })
})
</script>
</body>

</html>